import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
import javax.swing.*;

public class Card extends JLabel {
  private String huase;
  private int shuzi;
  private int dianshu;

  public String gethuase() { return huase; }

  public void sethuase(String huase) { this.huase = huase; }

  public int getshuzi() { return shuzi; }

  public void setshuzi(int shuzi) {
    this.shuzi = shuzi;
    if (this.shuzi > 10) {
      this.dianshu = 10;
    } else {
      this.dianshu = this.shuzi;
    }
  }

  public int getdianshu() { return dianshu; }

  public void loadImg(boolean isZhengmain) {
    String zhengfan = "";
    if (isZhengmain) {
      zhengfan = "img/" + huase + shuzi + ".bmp";
    } else {
      zhengfan = "img/背景03.jpg";
    }
    File f = new File(zhengfan);
    try {
      BufferedImage bi = ImageIO.read(f);
      ImageIcon icon = new ImageIcon(bi);
      this.setIcon(icon);
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
}
